{% extends "layout.html" %}
{% block subtitle %}Home{% endblock %}
{% block content %}
<div class="panel panel-default">
  <div class="panel-heading">Topics</div>
  {% for post in posts %}
  <div class="panel-body add-border">
      <a href="#"><img class="avatar" src="{{ post.avatar }}"></a>
      <div class="main">
        <div class="post-title"><a href="{{ url_for('main.topic', id=post.id) }}">{{ post.title }}</a></div>
        <div class="post-info">
          {{ time_delta(post.post_time) }}
          <a href="{{ url_for('account.user', username=post.username) }}">{{ post.username }}</a>
        </div>
      </div>
  </div>
  {% endfor %}
</div>
{% endblock %}

{% block sidebar %}
<div class="panel panel-default">
	<div class="panel-heading">Side Bar</div>
	<div class="panel-body">
    {% if current_user.is_authenticated() %}
    <a href="/user/{{current_user.username}}"><img src="{{ current_user.avatar(80) }}"></a>
	  <a class='btn btn-default' href='/post-topic'>Create New</a>
    {% endif %}
	</div>
</div>
{% endblock %}
